﻿// ===============================================================================
// DotNet.Platform 开发框架 2016 版权所有
// ===============================================================================

using System;
using System.Web.Mvc;
using DotNet.JCore.Entity;
using DotNet.JCore.Service;
using DotNet.Extensions;
using DotNet.Helper;
using DotNet.Utility;
using System.Collections.Generic;

namespace DotNet.Web.Controllers
{
    public class AccountLogController : BaseController
    {
        private AccountLogService service = new AccountLogService();

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Grid(string name, string pointId, string startDate, string endDate, string CreateId)
        {
            var list = service.GetPageList(PageInfo(), name, pointId, CreateId,
                startDate.ToDateTimeOrNull(), endDate.ToDateTimeOrNull());
            return View(list);
        }
        /// <summary>
        ///根据稽查点查询稽查人员（二级联动）
        /// </summary>
        /// <param name="PointID">稽查点</param>
        /// <returns></returns>
        public JsonResult GetPointName(string PointID)
        {
            List<SelectListItem> items = new List<SelectListItem>();
            if (!string.IsNullOrEmpty(PointID))
            {
                var emp = new EmployeeService().GetByPointId(PointID);
                foreach (Employee employees in emp)
                {
                    items.Add(new SelectListItem()
                    {
                        Text = string.Concat(employees.Name),
                        Value = employees.UserAccount.ToString()
                    });
                }
            }
            return Json(items, JsonRequestBehavior.AllowGet);
        }
    }
}
